package com.example.binpacking.config;

import com.example.binpacking.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截器解决需要拦截什么 不要拦截什么
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/**")
                //两个*
                .excludePathPatterns("/interviewer/**")
                //设置的反向代理需要一个/api所以路径需要两个api
                .excludePathPatterns("/pelicanpsyc/**")
                .excludePathPatterns("/swagger-ui.html", "/swagger-ui/**", "/v2/api-docs", "/webjars/**", "/swagger-resources/**"); // 应用于所有路径
//                .excludePathPatterns("/*");
    }
}
